{eju:static file="ask/skin/js/bootstrap-hover-dropdown.min.js" /}
<div class="sbox">
    <!-- 搜索 -->
    <div class="search">
        <form action="" method="get" name="search" id="search" onsubmit="return formSubmit();">
            <input type="hidden" name="ct" value="search">
            <input class="searchinput" name="q" placeholder="输入问题关键字" autocomplete="off" value="{$eju.field.SearchName}">
            <span class="search-icon" id="search-bottom" onclick="formSubmit();"></span>
            <div class="search-result">
            </div>
            <div class="hot-list" style="display: none;" id="search_keywords_list">
            </div>
        </form>
    </div>
    <!-- END -->

    <!-- 栏目导航 -->
    <ul class="nav navbar-nav navbar-right navlist" id="asktypes">
        <li class="nav-item">
            <a href="{$eju.field.NewDateUrl}" title="问答首页" class="link {eju:eq name='$eju.field.IsTypeId' value='0'}active{/eju:eq}">问答首页</a>
        </li>

        {eju:volist name="$eju.field.TypeData" id="vo"}
        <li class="margin-left-0 nav-item">
            <a class="link {eju:eq name='$eju.field.IsTypeId' value='$vo.type_id'}active{/eju:eq}" href="{$vo.Url}" data-hover="dropdown" aria-expanded="false">{$vo.type_name}
                {eju:notempty name="$vo.SubType"}
                    <span class="caret fa-angle-down"></span>
                {/eju:notempty}
            </a>
            {eju:notempty name="$vo.SubType"}
                <ul class="dropdown-menu dropdown-menu-right bullet" role="menu">
                    {eju:volist name="$vo.SubType" id="st"}
                        <li><a href="{$st.Url}">{$st.type_name}</a></li>
                    {/eju:volist}
                </ul>
            {/eju:notempty}
        </li>
        {/eju:volist}
    </ul>
    <!-- END -->
    <div class="clearfix"></div>
</div>
<div class=" blank10"></div>

<script type="text/javascript" charset="utf-8">
    $(function(){ 
        $('#search input[name=q]').click(function(){
            if ($('#search input[name=q]').val() == '') {
                $('#hot_keywords_list').show();
            }
        });
    }); 

    // 搜索提交
    function formSubmit()
    {
        var q = $('#search input[name=q]').val();
        var url = '{$eju.field.NewDateUrl}';
        if (url.indexOf('?') > -1) {
            url += '&';
        } else {
            url += '?';
        }
        url += 'search_name=' + q;
        window.location.href = url;
        return false;
    }
</script>